--[[
 -- *名称:NoticePart
 -- *描述:公告层
 -- *版权:Copyright © 2016-2018 深圳市三只小熊科技有限公司 版权所有
 -- *作者:Administrator
 -- *创建日期:2017-10-30
 -- *修改日期:2017-10-30
 ]]
local CURRENT_MODULE_NAME = ...
local NoticePart = class("NoticePart", PokerPartBase) --登录模块
NoticePart.DEFAULT_PART = {}
NoticePart.DEFAULT_VIEW = "noticelayer"

---
 -- [ctor 默认part构造方法]
 -- @DateTime 2017-09-20
 -- @param    owner [description]
 -- @param    data [description]
 -- @return    [description]
 --
function NoticePart:ctor(owner, data)
    NoticePart.super.ctor(self, owner, data)
    self._data = data;
end


---
 -- [activate 默认激活该part调用方法]
 -- @DateTime 2017-09-20
 -- @param    data [description]
 -- @return    [description]
 --
function NoticePart:activate(data)
	NoticePart.super.activate(self, CURRENT_MODULE_NAME)

	self:_reqNoticeData();
end

---
 -- [deactivate 销毁该part调用方法]
 -- @DateTime 2017-09-20
 -- @return   [description]
 --
function NoticePart:deactivate()
    NoticePart.super.deactivate(self,CURRENT_MODULE_NAME)
    if self.view == nil then
		return
	else
		self.view:removeSelf()
		self.view =  nil
	end
end
---
 -- [getPartId 获取该part的partId]
 -- @DateTime 2017-09-20
 -- @return   [description]
 --
function NoticePart:getPartId()
	-- body
	return "DdzNoticePart"
end
---
 -- 请求公告数据 
 -- @DateTime 2017-10-30
 -- @return   [description]
 --
function NoticePart:_reqNoticeData(  )
	local reqNoticeData = hjlobby_message_pb.GetGameConfigReq();
	reqNoticeData.type = 3
	global:getNetManager():sendProtoMsg(reqNoticeData, DdzSocketConfig.REQ_GAME_CONFIG, DdzGameConfig.GAME_ID);
end
---
 -- 获取到公告数据
 -- @DateTime 2017-10-30
 -- @param    data [description]
 -- @return    [description]
 --
function NoticePart:_onGetNoticeData( data )
	if data.resultCode == 0 and data.type == 3 and data.msg[1] then
		self:updateView("setNoticeContent", data.msg[1]);
	else 
		self:updateView("setNoticeContent", "获取公告失败!");
	end
end
---
 -- 事件映射表
 --
NoticePart.eventFuncMap = {
	[DdzEventConfig.EVENT_GET_GAME_CONFIG]		= NoticePart._onGetNoticeData;
};

return NoticePart 